package com.woniuxy.admin.controller;


import com.woniuxy.admin.service.RoleMenuService;
import com.woniuxy.core.annotation.Permission;
import com.woniuxy.core.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ...
 * @since 2024年05月22日
 */
@RestController
@RequestMapping("/roleMenu")
@Api(tags="菜单角色管理")
public class RoleMenuController {

    @Resource
    private RoleMenuService roleMenuService;

    /**
     * 绑定菜单和角色
     * @param menuIds  菜单ID集合
     * @param roleId   角色Id
     * @return
     */
    @GetMapping("/bindingRoleMenu")
    @ApiOperation("绑定菜单和角色")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "menuIds",value ="菜单ID集合" ),
            @ApiImplicitParam(name = "roleId",value ="角色ID" )
    })
    @Permission(roles = {"超级管理员","管理员"})
    public Result bindingRoleMenu(List<Integer> menuIds, Integer roleId){
        roleMenuService.bindingRoleMenu(menuIds,roleId);
        return Result.success("绑定菜单和角色成功",null);
    }
}

